#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define PRINT_SIZE(x) do { \
    cout << "size=" << x.size() << endl; \
} while (0)

#define PRINT_CAPACITY(x) do {\
    cout << "capacity=" << x.capacity() << endl; \
} while (0)


int main() 
{
    int i;
    vector<int> iv(2, 9);
    PRINT_SIZE(iv);     // size=2
    PRINT_CAPACITY(iv); // capacity=2

    iv.push_back(1);
    PRINT_SIZE(iv);     // size=3
    PRINT_CAPACITY(iv); // capacity=4

    iv.push_back(2);
    PRINT_SIZE(iv);     // size=4
    PRINT_CAPACITY(iv); //capacity=4

    iv.push_back(3);
    PRINT_SIZE(iv);     // size=5
    PRINT_CAPACITY(iv); // capacity=8

    iv.push_back(4);
    PRINT_SIZE(iv);     // size=6
    PRINT_CAPACITY(iv); // capacity=8

    for (auto i : iv) {
        cout << i << " ";
    }
    cout << endl;
    
    iv.push_back(5);
    PRINT_SIZE(iv);     // size=7
    PRINT_CAPACITY(iv); // capacity=8

    iv.pop_back();
    iv.pop_back();
    PRINT_SIZE(iv);     // size=5
    PRINT_CAPACITY(iv); // capacity=8

    iv.pop_back();
    PRINT_SIZE(iv);     // size=4
    PRINT_CAPACITY(iv); // capacity=8

    auto it = find(iv.begin(), iv.end(), 1);
    if (it != iv.end()) 
        iv.erase(it);
    
    PRINT_SIZE(iv);     // size=3
    PRINT_CAPACITY(iv); // capacity=8

    it = find(iv.begin(), iv.end(), 2);
    if (it != iv.end())
        iv.insert(it, 3, 7);
    PRINT_SIZE(iv);     // size=6
    PRINT_CAPACITY(iv); // capacity=8
    
    for(auto i : iv)
        cout << i << " ";
    cout << endl;

    iv.clear();
    PRINT_SIZE(iv);     // size=0
    PRINT_CAPACITY(iv); // capacity=8

    return 0;
}